#include <my_head.h>

int main(int argc, const char *argv[]){
    if(2 != argc){
        printf("Usage : %s pathname\n", argv[0]);
        return -1;
    }
    // 打开文件
    FILE *fp = fopen(argv[1], "r");
    if(NULL == fp)
        ERR_LOG("fopen error");
    // 开始统计行数
    int line = 0;
    char buff[10] = {0};
    while(NULL != fgets(buff, sizeof(buff), fp)){
        if('\n' == buff[strlen(buff)-1]){
            line++;
        }
    }
    printf("%d\n", line);
    // 关闭文件
    fclose(fp);
    return 0;
}